# -*- mode: snippet -*-
# name: ggplot x y template full
# key: ggplot2.xy.full.template
# --
ggplot(data = ${1:dt},
       aes(x = ${2:x}, y = ${3:y},
           colour = ${4:color},
           linetype = ${5:lty})) +
  geom_line(size = 1) +
  geom_hline(yintercept = 0.8, linetype="dotdash", color = "red", size = 0.9) +
  geom_hline(yintercept = 0.9, linetype="dotdash", color = "blue", size = 0.9) +
  ## scale_y_continuous(breaks=c(0, 0.25, 0.50, 0.75, 0.8, 1), labels = c(0, 0.25, 0.50, 0.75, 0.8, 1)) +
  scale_y_continuous(labels = scales::percent) +
  ## scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  ## scale_linetype_manual(values=c("dashed", "solid"))+
  ## scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9")) +
  scale_colour_brewer(palette = "Set2") +
  ## scale_colour_brewer(palette = "Greens") +
  ## scale_color_manual(values=c("#00AFBB","#FC4E07")) +
  xlab("${11:Number of Patients}") +
  ylab(expression(paste("${12:Power}"))) +
  labs(colour = "${13:True ORR}", linetype = expression(paste(alpha))) +
  theme(
    # labels of x-marker with angle
    axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1),
    axis.title.x = element_text(size=14),
    axis.title.y = element_text(size=14),
    legend.position = "inside",
    # Top-right
    legend.position.inside = c(.95, .95),
    legend.justification = c("right", "top"),
    legend.text = element_text(size = 12),
    legend.background = element_rect(fill = "transparent")
  )
